﻿<?php

/*
 * action : Login
 * param: user、password
 * return: uid、sex、money、rmb、coin、login_days、is_get、history[2] (total_win、total_lose)、total_borad、total_win、exp
 */
include_once("httpclient.php");
include_once("config.php");
include_once("mysql.php");

$url_prefix = "http://120.24.77.224/zjhapi/api.php?";
$action = "Login";

$mysql = new Mysql();
$ret = $mysql->connect(Config::$mysql_config);

if(!$ret){
	echo "connect error";
}

$result = $mysql->find("select * from player where id>0 and id <=5");
$row = count($result);
echo "row = ".$row.'<br>';
$mysql->close();

$param = array();

for ($i=0; $i<$row; $i++){
	$param['user'] = $result[$i]['user'];
	$param['password'] = $result[$i]['salt'];
	$param['vercode'] = "1";
	$param['ua'] = "XHC000";
	$param['imsi'] = "460000000000000";
	$param['imei'] = "350000000000000";
	$param['cid'] = "1000";
	echo $param['user']."      ".$param['password'];
	echo '<br>';
	test($param);
	echo '<br>';
}

function test($param){
	global $action;
	global $url_prefix;
	$param1 = $param;	
	$query = array();
	$query['action'] = $action;
    $query['ver'] = Config::$ver;
	$query['param'] = json_encode($param1);
	$url = $url_prefix . http_build_query($query);
	$client = new HttpClient();
	echo "<pre />";
	echo $client->get($url);
}

?>
